Fix Assistant exception with OpenAI#1017
Open
littlechu wants to merge 4 commits intopatterns-ai-core:mainfrom
Open
Fix Assistant exception with OpenAI#1017littlechu wants to merge 4 commits intopatterns-ai-core:mainfrom
littlechu wants to merge 4 commits intopatterns-ai-core:mainfrom
Conversation
…atterns-ai-core#998) Updates the requirements on [cohere-ruby](https://github.com/andreibondarev/cohere-ruby) to permit the latest version. - [Release notes](https://github.com/andreibondarev/cohere-ruby/releases) - [Changelog](https://github.com/patterns-ai-core/cohere-ruby/blob/main/CHANGELOG.md) - [Commits](patterns-ai-core/cohere-ruby@0.9.10...1.0.1) --- updated-dependencies: - dependency-name: cohere-ruby dependency-version: 1.0.1 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Since tool invocation from assistant is expected to be limited to public methods, `public_send` is used instead of `send` to avoid unintended invocation of private method. Co-authored-by: Sergio Bayona <bayona.sergio@gmail.com>
Author
|
issue seem to have fix with gem update for some of the require library. But I think the code should deal with the case where tool_calls being pass in as nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAI can report tool_calls: null. Which causes OpenAI assistant to raise exceptions due to the following check:
raise ArgumentError, "Tool calls must be an array of hashes" unless tool_calls.is_a?(Array) && tool_calls.all? { |tool_call| tool_call.is_a?(Hash) }
This fix is to make the check consider nil as an empty array. This change is related to #1011